<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>数组循环(for...of)</title>
    <script>
      let list = [10, 20, 30];
      Array.prototype.Len = function () {};
      /*
       *    for...in
       *    遍历数组的所有属性
       */

      for (let val in list) {
        console.log(val, list[val]);
        /* 结果
         * 0 10
         * 1 20
         * 2 30
         * len function(){}
         */
      }
      /*
       *    for...of
       *    只遍历数组值
       */
      for (let val of list) {
        console.log(val);
        /* 结果
         * 10
         * 20
         * 30
         */
      }
    </script>
  </head>
  <body></body>
</html>
